home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / amigaoscd / amigapluscd / AP-Website / forum / wbboard / newthread.php < prev    next >
Text File  |  2002-03-15  |  6KB  |  143 lines

  1. <? 
  2. require("_functions.php");
  3. require("_header.php");
  4.                 
  5. if($userdata[canstarttopic] && check_boardobject($boardid,$user_group,"startpermission")) {
  6.     if($action == "send" && !$preview && !$post_poll) {
  7.         if(!$subject || !$message  || $p_fields != count($pfield) || ($p_fields && !$ptitle) || check_posts($message)) {
  8.             if($p_fields) {
  9.                 $post_poll = 1;
  10.                 $poll_fields = $p_fields;
  11.             }
  12.             eval ("\$error = \"".gettemplate("newthread_error")."\";");
  13.         }
  14.         else {
  15.             if($user_id && !$userdata[avoidfc] && floodcontrol($user_id)) {
  16.                 require("_board_jump.php");
  17.                 eval("dooutput(\"".gettemplate("floodcontrol")."\");");
  18.                 exit;
  19.             }
  20.             
  21.             $time = time();
  22.                 $subject = editPostdata($subject);
  23.                 $message = editPostdata($message);
  24.                 if($parseurl) $message = parseURL($message);
  25.  
  26.                 if($disablesmilies!=1) $disablesmilies=0;
  27.                 if($signature!=1) $signature=0;
  28.                     $db_zugriff->query("UPDATE bb".$n."_user_table SET userposts=userposts+1 WHERE userid='$user_id'");
  29.                     
  30.                     $db_zugriff->query("INSERT INTO bb".$n."_threads (boardparentid,threadname,starttime,authorid,author,lastposterid,timelastreply,topicicon) VALUES ('$boardid','$subject','$time','$user_id','$user_name','$user_id','$time','$posticon')");
  31.                 $nr = $db_zugriff->insert_id();
  32.                 if($email && $user_id) $db_zugriff->query("INSERT INTO bb".$n."_notify VALUES ($nr,$user_id)");
  33.                 $db_zugriff->query("INSERT INTO bb".$n."_posts (boardparentid,threadparentid,userid,posttime,posttopic,message,posticon,disable_smilies,signature,ip) VALUES ('$boardid','$nr','$user_id','$time','$subject','$message','$posticon','$disablesmilies','$signature','".getenv("REMOTE_ADDR")."')");
  34.             $postid = $db_zugriff->insert_id();
  35.             $db_zugriff->query("UPDATE bb".$n."_boards SET threads=threads+1, posts=posts+1, lastposttime = '$time', lastpostid = '$postid' WHERE boardid = '$boardid'");    
  36.                         
  37.             if($p_fields) {
  38.                 $db_zugriff->query("UPDATE bb".$n."_threads SET pquestion = '".editPostdata($ptitle)."', ptimeout = '".(int)($poll_timeout)."' WHERE threadid = '$nr'");
  39.                 for($i = 0; $i < $p_fields; $i++) $db_zugriff->query("INSERT INTO bb".$n."_poll VALUES ('','$nr','".editPostdata($pfield[$i])."','0')");
  40.             }
  41.         
  42.             $ride = getLastPost($user_id,4);
  43.                     header("Location: $ride");
  44.             exit; 
  45.         }
  46.     }    
  47.     if($ch_parseurl) $checked[0] = "CHECKED";
  48.     if($ch_email) $checked[1] = "CHECKED";
  49.     if($ch_disablesmilies) $checked[2] = "CHECKED";
  50.     if($ch_signature) $checked[3] = "CHECKED";
  51.                 
  52.     if($post_poll) {
  53.         $subject = prepare_topic($subject);
  54.         $message = stripslashes($message);     
  55.         
  56.         if($parseurl) $checked[0] = "CHECKED";
  57.         else $checked[0] = "";
  58.         if($email) $checked[1] = "CHECKED";
  59.         else $checked[1] = "";
  60.         if($disablesmilies) $checked[2] = "CHECKED";
  61.         else $checked[2] = "";
  62.         if($signature) $checked[3] = "CHECKED";
  63.         else $checked[3] = "";
  64.             
  65.         for($i = 0; $i < $poll_fields; $i++) {
  66.             $j = $i+1;
  67.             $wert = prepare_topic($pfield[$i]);
  68.             eval ("\$fields .= \"".gettemplate("newthread_pollbit")."\";");
  69.         }
  70.         eval ("\$poll .= \"".gettemplate("newthread_poll")."\";");
  71.     }
  72.     
  73.     if($action == "send") {
  74.      $subject=stripslashes($subject);    
  75.      $message=stripslashes($message);    
  76.     }
  77.             
  78.     if($preview) {
  79.         $subject = prepare_topic($subject);
  80.                 $user_info = $db_zugriff->query_first("SELECT signatur FROM bb".$n."_user_table WHERE username='$user_name'");
  81.                 if($user_info[signatur] && $signature && !$hide_signature) {
  82.                           $signatur = editPost($user_info[signatur],$disablesmilies);
  83.             eval ("\$pre_signature = \"".gettemplate("thread_signature")."\";");
  84.         }
  85.                 if($posticon) $pre_posticon = "<img src=\"".$posticon."\">";
  86.                 else $pre_posticon = " ";
  87.                 $post = editPost($message,$disablesmilies);
  88.                 $message = stripslashes($message);             
  89.                 eval ("\$preview = \"".gettemplate("preview")."\";");
  90.                         
  91.                 if($parseurl) $checked[0] = "CHECKED";
  92.         else $checked[0] = "";
  93.         if($email) $checked[1] = "CHECKED";
  94.         else $checked[1] = "";
  95.         if($disablesmilies) $checked[2] = "CHECKED";
  96.         else $checked[2] = "";
  97.         if($signature) $checked[3] = "CHECKED";
  98.         else $checked[3] = "";
  99.             
  100.         if($p_fields) {
  101.             $ptitle = prepare_topic($ptitle);
  102.             for($i = 0; $i < $p_fields; $i++) {
  103.                 $j = $i+1;
  104.                 $wert = prepare_topic($pfield[$i]);
  105.                 eval ("\$fields .= \"".gettemplate("newthread_pollbit")."\";");
  106.             }
  107.             $poll_fields = $p_fields;    
  108.             eval ("\$poll = \"".gettemplate("newthread_poll")."\";");
  109.             eval ("\$poll_check = \"".gettemplate("newthread_pollcheck")."\";");
  110.             $post_poll = 1;
  111.         }
  112.     }
  113.     else $subject=htmlspecialchars($subject);
  114.         
  115.     if($bbcode && $u_bbcode) $bbcode_buttons = getcodebuttons();
  116.     if($smilies && $u_bbcode) $bbcode_smilies = getclickysmilies(3,$anzahl_smilies);
  117.  
  118.     if($html) eval ("\$note .= \"".gettemplate("newthread_html_enable")."\";");
  119.     else eval ("\$note .= \"".gettemplate("newthread_html_disable")."\";");
  120.     if(!$smilies) eval ("\$note .= \"".gettemplate("newthread_smilies_disable")."\";");
  121.     if(!$bbcode) eval ("\$note .= \"".gettemplate("newthread_bbcode_disable")."\";");
  122.         
  123.     include("templates/posticons.php");
  124.     for($i = 0; $i < count($posticons); $i++) {
  125.         if(is_int($i/6) && $i) $choice_posticons .= "<br>";
  126.         elseif($i) $choice_posticons .= "    ";
  127.         $choice_posticons .= "<INPUT type=\"radio\" name=\"posticon\" value=\"$posticons[$i]\"";
  128.         if($posticon == $posticons[$i]) $choice_posticons .= " CHECKED";
  129.         $choice_posticons .= ">  <img src=\"$posticons[$i]\">";
  130.     }
  131.     if(!$posticon) $noicon[0] = "CHECKED"; 
  132.         
  133.     $navi_chain = makenavichain("newthread",$boardid);
  134.     if(!$post_poll && $polls && $userdata[canpostpoll]) eval ("\$poll .= \"".gettemplate("newthread_startpoll")."\";");
  135.     
  136.     if($userid) eval ("\$quick_logout .= \"".gettemplate("newthread_logout")."\";");
  137.     $message=htmlspecialchars($message);
  138.     eval("dooutput(\"".gettemplate("newthread")."\");");
  139.     
  140. }
  141. else header("LOCATION: misc.php?action=access_error&boardid=$boardid&styleid=$styleid$session");
  142. ?>
  143.